package cn.cdeden.knowledge.service;

import cn.cdeden.common.core.utils.page.TableDataInfo;
import cn.cdeden.knowledge.domain.FilesShare;
import cn.cdeden.knowledge.domain.TreeDownloadFiles;
import cn.cdeden.knowledge.domain.dto.FilesShareDto;
import cn.cdeden.knowledge.domain.dto.ShareDownloadFilesDto;
import cn.cdeden.knowledge.domain.dto.ShareGetInfoDto;
import cn.cdeden.resource.api.domain.RemoteFilesDownload;
import com.baomidou.mybatisplus.extension.service.IService;
import io.undertow.util.BadRequestException;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Map;

public interface FilesShareService extends IService<FilesShare>{

    /**
     * 通过文件id查询多个分享链接
     *
     * @param fileId 文件id
     * @param type
     * @return List<FilesShareDto>
     */
    TableDataInfo<FilesShareDto> queryByFileId(String fileId, String type, String teamId, Pageable pageable) throws BadRequestException;


    FilesShare getById(Long id);


    FilesShareDto findById(Long id);

    FilesShare updateById(FilesShareDto resources);

    Map<String,Object> queryShareFileUrl(String id, String fileId);

    /**
     * 通过分享人id查询我的分享
     *
     * @param userId 当前用户id
     * @param type
     * @param teamId
     * @return List<FilesShareDto>
     */
    TableDataInfo<FilesShareDto> queryBySPerson(String userId,String type,String teamId,String name, Pageable pageable);


    FilesShare insert(FilesShareDto resources) throws BadRequestException;


    /**
     * 通过被分享人id查询被分享的
     * @param userId 当前用户id
     * @param type 库的类型
     * @param teamId 团队编号
     * @return List<FilesShareDto>
     */
    TableDataInfo<FilesShareDto> queryBySdPerson(String userId, String type, String teamId, String name, Pageable pageable);



    /**
     * 查看分享文件
     */
    FilesShareDto shareGetInfo(FilesShare filesShare);
    FilesShareDto shareDirList(ShareGetInfoDto shareGetInfoDto);


    void delAllBySPerson(String userId,String type,String teamId);

    List<RemoteFilesDownload> shareDownload(ShareDownloadFilesDto downloadFilesDto);
}
